﻿using System;

namespace RandomAndSort
{
    class Program
    {
        public static void Main(string[] args)
        {
            Random rand = new Random();
            double sum = 0;
            double average = 0;
            int[] a = new int[100];

            for(int i = 0; i < 100; i++)
            {
                a[i] = rand.Next(1000)+1;
            }

            a.OrderByDescending(x => x).Take(a.Length);
            for(int i = 0; i < a.Length; i++)
            {
                sum += a[i];
            }
            Console.WriteLine("100个随机数的总和为：" + sum);
            average = sum / a.Length;
            Console.WriteLine("100个随机数的平均值为：" + average);
        }
    }
}